<!--------------账户安全页面------------------>
<template>
  <div>
    <topheader :toptitle="toptitle"/>
    <div class="wrapper">
      <div class="wrapper-inner">
        <ul class="safe-list clearfix">
          <li class="l safe-list-item" @click="certifyBind">
            <img src="static/img/icon-realname.png"/>
            <p>实名认证</p>
            <div class="choosebind" :class="{checkbind:isCertify}"></div>
          </li>
          <li class="l safe-list-item" @click="phoneBind">
            <img src="static/img/icon-bindphone.png"/>
            <p>绑定手机</p>
            <div class="choosebind" :class="{checkbind:isBindMobile}"></div>
          </li>
          <li class="l safe-list-item" @click="pwdSet">
            <img src="static/img/icon-setpwd.png"/>
            <p>修改密码</p>
            <div class="choosebind" :class="{checkbind:isChangePwd}"></div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
  import topheader from "@/components/topheader"

  export default {
    name: "usersafe",
    components: {
      "topheader": topheader
    },
    data() {
      return {
        toptitle: "账号安全",
        isCertify: userInfoKit.getUserInfo().idCard == "" ? false : true,
        isBindMobile: userInfoKit.getUserInfo().mobile == "" ? false : true,
        isChangePwd: userInfoKit.getUserInfo().hasPwd == "" ? false : true
      }
    },
    created() {
    },
    methods: {
      certifyBind: function () {
        let userInfo = userInfoKit.getUserInfo()
        if (userInfo == null || userInfo.idCard == "") {
          // 跳转到实名认证页面
          this.$router.push("/certify")
        } else {
          //跳转到已实名认证展示用户信息页面
          this.$router.push("/identitybinded")
        }
      },
      phoneBind: function () {
        let userInfo = userInfoKit.getUserInfo()
        if (userInfo == null || userInfo.mobile == "") {
          // 跳转到绑定手机号页面
          this.$router.push("/bindphone")
        } else {
          // 跳转到手机号已绑定展示用户信息页面
          this.$router.push("/phonebinded")
        }
      },
      pwdSet: function () {
        // 跳转到修改密码页面
        this.$router.push("/changepwd")
      }
    }
  }
</script>
